<style scoped>
.aaaaaa {
  background-color: #fff;
  width: 100%;
}
</style>
<template>
  <div class="aaaaaa">
    <div>
      <input
        type="file"
        name="file"
        accept=".jpg, .jpeg, .png"
        @change="uploadAvatar"
      />
    </div>
    <!-- <span>{{baseURL}}</span> -->
    <img :src="$baseURL+'/images/detail/default.png'" alt="">
  </div>
</template>

<script>
// import OrderItem from "../components/OrderItem";
import axios from 'axios'
export default {
  // components: { OrderItem },
  data() {
    return {};
  },
  methods: {
    uploadAvatar(avatar) {
      console.log(avatar.target.files[0]);
      let file = avatar.target.files[0];
      let data = new FormData();
      data.append("file", file, file.name);
      data.append("data", 112);
      console.log(data.get("file"));

      axios.post("/api/updata", data).then(
        function (data) {
          console.log(data);
        },
        function (response) {
          console.log(response);
        }
      );
    },
  },
};
</script>